<?php
/**
 * Created by PhpStorm.
 * User: liubin
 * Date: 16/9/27
 * Time: 上午9:20
 */

namespace api\Model;

use Think\Model;

class TagEntityModel extends Model
{
    function __construct() {
        $this->model = M('TagEntity');
        $this->model_1 = M('CircleEntity');
    }

    public function getTagname($condition = array()) {


        $data = $this->model->where(array('tag_id' => $condition))->field('tag_name')->find();
        $data = $data ? $data : array();
        return $data;
    }

    public function getTagname1($type) {
        if($type){
            $condition="type=$type";
        }else{
            $condition="";
        }
        $data = $this->model->where($condition)->field('tag_id,tag_name,type')->select();
        $data = $data ? $data : array();
        return $data;
    }

    public function getTagname2() {
        $data = $this->model_1->field('*')->order('sort asc')->select();
        $data = $data ? $data : array();
        return $data;
    }

    public function getTagname3($tag_id) {
        $data = $this->model->where('tag_id='.$tag_id)->field('tag_name')->find();
        return $data;
    }

    public function getDiarytag($condition = array()){
        $data = $this->model->where($condition)->select();
        $data = $data ? $data : array();
        return $data;
    }

}